package com.hdu.lisener;


import com.hdu.lisener.core.EventDispatcher;
import com.hdu.lisener.holder.ApplicationContextHolder;
import com.hdu.lisener.test.SendMessageEvent;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(
                Application.class,
                args
        );

        // 获得事件派发器
        EventDispatcher dispatcher = ApplicationContextHolder.getBean(EventDispatcher.class);

        SendMessageEvent sendMessageEvent = new SendMessageEvent("qyh", "zwd", "this is test Content ");

        dispatcher.dispatchEvent(sendMessageEvent);
        // c.h.l.t.SendMessageApplicationListenerV1 : start to send message v1 : SendMessageEvent(from=qyh, to=zwd, content=this is test Content )
        // c.h.l.t.SendMessageApplicationListenerV2 : start to send message v2 : SendMessageEvent(from=qyh, to=zwd, content=this is test Content )
    }
}
